import service from "../index";

export const getAllHomestay = async () => {
  return await service({
    method: "get",
    url: "/homestay/getAllHomestay",
  });
};

//删除
export const deleteHomestay = async (id: number) => {
  return await service({
    method: "post",
    url: "/homestay/deleteHomestay",
    data: { id: id },
  });
};

//批量删除
export const batchHomestay = async (ids: any) => {
  return await service({
    method: "post",
    url: "/homestay/batchHomestay",
    data: { ids: ids },
  });
};

//搜索
export const searchHomestay = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/searchHomestay",
    data: params,
  });
};

//根据房源标题搜索
export const searchHomestayByTitle = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/searchHomestayByTitle",
    data: params,
  });
};

//根据房源标题搜索已上线房源
export const searchOnlineHomeByTitle = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/searchOnlineHomeByTitle",
    data: params,
  });
};

//获取已上线房源列表
export const getAllOnlineHomeList = async () => {
  return await service({
    method: "get",
    url: "/homestay/getAllOnlineHomeList",
  });
};

//编辑获取房源详情
export const getHome = async (id: number) => {
  return await service({
    method: "get",
    url: "/homestay/getHome?id=" + id,
  });
};

//添加房源
export const addHomestay = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/adminAddHomestay",
    data: params,
  });
};

//修改房源不修改图片
export const updateHomeByAdmin = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/updateHomeByAdmin",
    data: params,
  });
};

//
export const searchShenheHomestay = async (params: any) => {
  return await service({
    method: "post",
    url: "/homestay/searchShenheHomestay",
    data: params,
  });
};
